\hypertarget{group__nxbot__buzzer}{
\section{BUZZER Library}
\label{group__nxbot__buzzer}\index{BUZZER Library@{BUZZER Library}}
}


Interrupt-\/driven buzzer library for implementing a sound device.  
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \{ \par
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba7865be2e2f2e53f035590828c1939399}{DO1} =  0, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab9b824b7183178f46da6770515969caf}{RE1}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba7d51053c886f885c59fd09eecde2d64e}{MI1}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba2bdbaac20ccd2d352eebcc9666c90094}{FA1}, 
\par
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba9280aaf98b42e67e79a7e69796acfe8d}{SOL1}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba225d3eab04b6b64ba26989690bd14706}{LA1}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba89b0d0a3e1877c9daebb3df40af18e41}{SI1}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba84631f113424d76e0c4d1f49c16c3b58}{DO2}, 
\par
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba67d3cc824318cd78a1345e62fa40a6b1}{RE2}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bafabc2c3a5ede4c38de058ea4ecdc42ae}{MI2}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab689b9a5b27bd2782cfdc856a551225a}{FA2}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab25d5e803931cfd74a0b70ad366e06f1}{SOL2}, 
\par
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba917616fef8fd0ada11ec0d0ea18c4f6b}{LA2}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bad2e66c8454ee356967bb8b3890d66c9a}{SI2}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba0337d2b986de0114d8cd2e2268fb3c0a}{DO3}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba553e4820114819f54977df912785b5b2}{RE3}, 
\par
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba5af6ceacc23fb50da3c4c2d732f2f21d}{MI3}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba6b7ac6730809368b8a37a6ecc8d9eb4d}{FA3}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba2f29696f753a479cee3d3129871e483d}{SOL3}, 
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba8fd81b0feca992dd04a58581ed037066}{LA3}, 
\par
\hyperlink{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba694a06492df52a9b1821a14e3c7794c4}{SI3}
 \}
\begin{DoxyCompactList}\small\item\em Definition of three note-\/scales. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__nxbot__buzzer_ga0cead532fdd0c0de5fa1c1de0f6556bd}{buzzer\_\-init} (void)
\begin{DoxyCompactList}\small\item\em Initialize the buzzer hardware. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__buzzer_ga63f4d0e2dec60a4fcbe0de3824bd2d06}{buzzer\_\-enable} (void)
\begin{DoxyCompactList}\small\item\em Enables the buzzer. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__buzzer_ga1310d5aed0a0534924cc5d0ce387b3f2}{buzzer\_\-disable} (void)
\begin{DoxyCompactList}\small\item\em Disables the buzzer. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__buzzer_gaa0677130ef1e000d60ab1527898e0ccf}{buzzer\_\-note} (unsigned char note)
\begin{DoxyCompactList}\small\item\em Specifies the note that should be generated. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__buzzer_gab2f545156f46ae35716d592e13465d25}{buzzer\_\-silence} (unsigned char time)
\begin{DoxyCompactList}\small\item\em Disables the buzzer for a defined time. Not yet implemented. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Interrupt-\/driven buzzer library for implementing a sound device. 
\begin{DoxyCode}
 #include <buzzer.h> 
\end{DoxyCode}
 This module is used to generate musical notes with the robot NXBot. The frequencies for each note are produced using a time interrupt strategy. That means, one of the timers of the microcontroller is used for timing purposes, in order to obtain non-\/blocking functions. Therefore, it is necessary to enable interrupts, for example via the {\itshape sei()\/} function. 

\subsection{Enumeration Type Documentation}
\hypertarget{group__nxbot__buzzer_ga06fc87d81c62e9abb8790b6e5713c55b}{
\subsubsection[{"@0}]{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}}
\label{group__nxbot__buzzer_ga06fc87d81c62e9abb8790b6e5713c55b}


Definition of three note-\/scales. \begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{DO1@{DO1}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!DO1@{DO1}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba7865be2e2f2e53f035590828c1939399}{
DO1}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba7865be2e2f2e53f035590828c1939399}
}]\index{RE1@{RE1}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!RE1@{RE1}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab9b824b7183178f46da6770515969caf}{
RE1}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab9b824b7183178f46da6770515969caf}
}]\index{MI1@{MI1}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!MI1@{MI1}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba7d51053c886f885c59fd09eecde2d64e}{
MI1}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba7d51053c886f885c59fd09eecde2d64e}
}]\index{FA1@{FA1}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!FA1@{FA1}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba2bdbaac20ccd2d352eebcc9666c90094}{
FA1}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba2bdbaac20ccd2d352eebcc9666c90094}
}]\index{SOL1@{SOL1}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!SOL1@{SOL1}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba9280aaf98b42e67e79a7e69796acfe8d}{
SOL1}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba9280aaf98b42e67e79a7e69796acfe8d}
}]\index{LA1@{LA1}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!LA1@{LA1}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba225d3eab04b6b64ba26989690bd14706}{
LA1}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba225d3eab04b6b64ba26989690bd14706}
}]\index{SI1@{SI1}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!SI1@{SI1}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba89b0d0a3e1877c9daebb3df40af18e41}{
SI1}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba89b0d0a3e1877c9daebb3df40af18e41}
}]\index{DO2@{DO2}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!DO2@{DO2}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba84631f113424d76e0c4d1f49c16c3b58}{
DO2}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba84631f113424d76e0c4d1f49c16c3b58}
}]\index{RE2@{RE2}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!RE2@{RE2}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba67d3cc824318cd78a1345e62fa40a6b1}{
RE2}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba67d3cc824318cd78a1345e62fa40a6b1}
}]\index{MI2@{MI2}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!MI2@{MI2}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bafabc2c3a5ede4c38de058ea4ecdc42ae}{
MI2}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bafabc2c3a5ede4c38de058ea4ecdc42ae}
}]\index{FA2@{FA2}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!FA2@{FA2}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab689b9a5b27bd2782cfdc856a551225a}{
FA2}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab689b9a5b27bd2782cfdc856a551225a}
}]\index{SOL2@{SOL2}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!SOL2@{SOL2}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab25d5e803931cfd74a0b70ad366e06f1}{
SOL2}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bab25d5e803931cfd74a0b70ad366e06f1}
}]\index{LA2@{LA2}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!LA2@{LA2}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba917616fef8fd0ada11ec0d0ea18c4f6b}{
LA2}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba917616fef8fd0ada11ec0d0ea18c4f6b}
}]\index{SI2@{SI2}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!SI2@{SI2}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bad2e66c8454ee356967bb8b3890d66c9a}{
SI2}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55bad2e66c8454ee356967bb8b3890d66c9a}
}]\index{DO3@{DO3}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!DO3@{DO3}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba0337d2b986de0114d8cd2e2268fb3c0a}{
DO3}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba0337d2b986de0114d8cd2e2268fb3c0a}
}]\index{RE3@{RE3}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!RE3@{RE3}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba553e4820114819f54977df912785b5b2}{
RE3}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba553e4820114819f54977df912785b5b2}
}]\index{MI3@{MI3}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!MI3@{MI3}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba5af6ceacc23fb50da3c4c2d732f2f21d}{
MI3}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba5af6ceacc23fb50da3c4c2d732f2f21d}
}]\index{FA3@{FA3}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!FA3@{FA3}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba6b7ac6730809368b8a37a6ecc8d9eb4d}{
FA3}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba6b7ac6730809368b8a37a6ecc8d9eb4d}
}]\index{SOL3@{SOL3}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!SOL3@{SOL3}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba2f29696f753a479cee3d3129871e483d}{
SOL3}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba2f29696f753a479cee3d3129871e483d}
}]\index{LA3@{LA3}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!LA3@{LA3}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba8fd81b0feca992dd04a58581ed037066}{
LA3}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba8fd81b0feca992dd04a58581ed037066}
}]\index{SI3@{SI3}!nxbot\_\-buzzer@{nxbot\_\-buzzer}}\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!SI3@{SI3}}\item[{\em 
\hypertarget{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba694a06492df52a9b1821a14e3c7794c4}{
SI3}
\label{group__nxbot__buzzer_gga06fc87d81c62e9abb8790b6e5713c55ba694a06492df52a9b1821a14e3c7794c4}
}]\end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{group__nxbot__buzzer_ga1310d5aed0a0534924cc5d0ce387b3f2}{
\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!buzzer\_\-disable@{buzzer\_\-disable}}
\index{buzzer\_\-disable@{buzzer\_\-disable}!nxbot_buzzer@{nxbot\_\-buzzer}}
\subsubsection[{buzzer\_\-disable}]{\setlength{\rightskip}{0pt plus 5cm}void buzzer\_\-disable (void)}}
\label{group__nxbot__buzzer_ga1310d5aed0a0534924cc5d0ce387b3f2}


Disables the buzzer. The timer returns to stopped-\/state. \hypertarget{group__nxbot__buzzer_ga63f4d0e2dec60a4fcbe0de3824bd2d06}{
\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!buzzer\_\-enable@{buzzer\_\-enable}}
\index{buzzer\_\-enable@{buzzer\_\-enable}!nxbot_buzzer@{nxbot\_\-buzzer}}
\subsubsection[{buzzer\_\-enable}]{\setlength{\rightskip}{0pt plus 5cm}void buzzer\_\-enable (void)}}
\label{group__nxbot__buzzer_ga63f4d0e2dec60a4fcbe0de3824bd2d06}


Enables the buzzer. The last configured note defined with \hyperlink{group__nxbot__buzzer_gaa0677130ef1e000d60ab1527898e0ccf}{buzzer\_\-note()} will be generated. \hypertarget{group__nxbot__buzzer_ga0cead532fdd0c0de5fa1c1de0f6556bd}{
\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!buzzer\_\-init@{buzzer\_\-init}}
\index{buzzer\_\-init@{buzzer\_\-init}!nxbot_buzzer@{nxbot\_\-buzzer}}
\subsubsection[{buzzer\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void buzzer\_\-init (void)}}
\label{group__nxbot__buzzer_ga0cead532fdd0c0de5fa1c1de0f6556bd}


Initialize the buzzer hardware. Enables the pin where the buzzer will be connected. Configures timer 4 but it remains stopped. \hypertarget{group__nxbot__buzzer_gaa0677130ef1e000d60ab1527898e0ccf}{
\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!buzzer\_\-note@{buzzer\_\-note}}
\index{buzzer\_\-note@{buzzer\_\-note}!nxbot_buzzer@{nxbot\_\-buzzer}}
\subsubsection[{buzzer\_\-note}]{\setlength{\rightskip}{0pt plus 5cm}void buzzer\_\-note (unsigned char {\em note})}}
\label{group__nxbot__buzzer_gaa0677130ef1e000d60ab1527898e0ccf}


Specifies the note that should be generated. Generates one of the notes of the three configured scales. 
\begin{DoxyParams}{Parameters}
\item[{\em note}]One of the notes previously defined, e.g RE1. \end{DoxyParams}
\hypertarget{group__nxbot__buzzer_gab2f545156f46ae35716d592e13465d25}{
\index{nxbot\_\-buzzer@{nxbot\_\-buzzer}!buzzer\_\-silence@{buzzer\_\-silence}}
\index{buzzer\_\-silence@{buzzer\_\-silence}!nxbot_buzzer@{nxbot\_\-buzzer}}
\subsubsection[{buzzer\_\-silence}]{\setlength{\rightskip}{0pt plus 5cm}void buzzer\_\-silence (unsigned char {\em time})}}
\label{group__nxbot__buzzer_gab2f545156f46ae35716d592e13465d25}


Disables the buzzer for a defined time. Not yet implemented. No sound will be generated until time is concluded. WARNING!!! THIS FUNCTION IS NOT (YET) IMPLEMENTED. 